﻿using System;
using System.Web;
using System.Web.UI;
using System.Linq;
using SharedLibraries;
using EntityObject;
using ThangNM_LIB.FUNC;
using ThangNM_LIB.EO;

namespace ThangNM.UserControl
{
    public partial class Vote_Share_CommentUC : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
        }

        public void BindData(MetaTagEO _MetaTagEO, Boolean isShowCmt)
        {
            try
            {
                lblVote.CssClass = "rw-ui-container rw-urid-" + RewriteUrl.ConvertToUnSign(_MetaTagEO.sCanonical);
                pnlCmt.Visible = isShowCmt;
                if (isShowCmt)
                {
                    ClientScriptManager cs = Page.ClientScript;
                    if (!cs.IsClientScriptBlockRegistered(this.GetType(), "Disqus_Comment"))
                    {
                        String csText = "<script type=\"text/javascript\">" +
                            "var disqus_shortname = 'nguyenmanhthang';" +
                            "var disqus_identifier = '" + RewriteUrl.ConvertToUnSign(_MetaTagEO.sCanonical) + "';" +
                            "var disqus_title = '" + _MetaTagEO.sTitle + "';" +
                            "var disqus_url = '" + System.Configuration.ConfigurationManager.AppSettings["HOMEPAGE"] + _MetaTagEO.sCanonical + "';" +
                            "</script>";
                        cs.RegisterClientScriptBlock(this.GetType(), "Disqus_Comment", csText.ToString());
                    }
                }
            }
            catch
            {
            }
        }

        public void BindData_NEW(SEOEO _SEOEO, Boolean isShowCmt)
        {
            try
            {
                lblVote.CssClass = "rw-ui-container rw-urid-" + Commons.createUniqueID(_SEOEO);
                pnlCmt.Visible = isShowCmt;
                if (isShowCmt)
                {
                    ClientScriptManager cs = Page.ClientScript;
                    if (!cs.IsClientScriptBlockRegistered(this.GetType(), "Disqus_Comment"))
                    {
                        String csText = "<script type=\"text/javascript\">" +
                            "var disqus_shortname = 'nguyenmanhthang';" +
                            "var disqus_identifier = '" + Commons.createUniqueID(_SEOEO) + "';" +
                            "var disqus_title = '" + _SEOEO.sTitle + "';" +
                            "var disqus_url = '" + OtherEx.AddDomainInUrl(_SEOEO.sUrlRewrite) + "';" +
                            "</script>";
                        cs.RegisterClientScriptBlock(this.GetType(), "Disqus_Comment", csText.ToString());
                    }
                }
            }
            catch
            {
            }
        }
    }
}